#include <iostream>
#include "Utils/netTools.h"
#include "Protocol/TCP/TCPClient.h"


#include <array>
#include <map>
#include "./Utils/BinPack.hpp"
struct MyStruct
{
    bool Bo;
    int8_t A;
    int32_t B;
    std::string S;
    std::array<int, 3> Arr;
    std::map<int, std::string> Ma;

    void pack(BinPack::Packer& avlue) {
        avlue(Bo, A, B, S, Arr, Ma); 
    }
	void unPack(BinPack::unPacker& avlue) {
		avlue(Bo, A, B, S, Arr, Ma);
	}
};

int main(int argc, char const *argv[])
{
    MyStruct tt;
    tt.Bo = false;
    tt.A = 5;
    tt.B = 12345;
    tt.S = "test";
    tt.Arr[0] = 10;
    tt.Arr[1] = 20;
    tt.Arr[2] = 30;
    tt.Ma[2] = "1111";
    tt.Ma[3] = "3333";
    tt.Ma[6] = "6666";
    auto xx = BinPack::pack(tt);

    MyStruct Xy;
    Xy = BinPack::unpack<MyStruct>(xx);

    setup_socket();

    //std::cout << domain2IP("www.baidu.com") << std::endl;
    protocol::TCPClient tcpclient("127.0.0.1",8081);
    tcpclient.startService();


    clean_socket();
    return 0;
}
